package com.qianxx.component.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.qianxx.component.R;
import com.qianxx.component.activity.base.BaseActivity;
import com.qianxx.component.activity.text.anim_number.AnimNumberActivity;
import com.qianxx.component.activity.text.auto_text_view.AutoTextViewActivity;
import com.qianxx.component.activity.text.contains_emoji_edit_text.ContainsEmojiEditTextActivity;
import com.qianxx.component.activity.text.grid_pass_word_view.GridPasswrodViewActivity;
import com.qianxx.component.activity.text.random_number.RandomNumberActivity;
import com.qianxx.component.activity.text.wheel_view.WheelViewActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnItemClick;

public class TextActivity extends BaseActivity {
    @BindView(R.id.lv)
    ListView lv;
    private ArrayAdapter adapter;
    private String[] listItems = {"AutoTextView", "GridPasswordView", "Wheelview",
            "ContainsEmojiEditText", "AnimNumber","RandomNumber"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_text);
        ButterKnife.bind(this);

        adapter = new ArrayAdapter(this, R.layout.item, listItems);
        lv.setAdapter(adapter);
    }

    @OnItemClick(R.id.lv)
    void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
        Class cls = null;
        switch (arg2) {
            case 0:
                cls = AutoTextViewActivity.class;
                break;
            case 1:
                cls = GridPasswrodViewActivity.class;
                break;
            case 2:
                cls = WheelViewActivity.class;
                break;
            case 3:
                cls = ContainsEmojiEditTextActivity.class;
                break;
            case 4:
                cls = AnimNumberActivity.class;
                break;
            case 5:
                cls = RandomNumberActivity.class;
                break;
            default:
                break;
        }
        Intent intent = new Intent(this, cls);
        startActivity(intent);
    }

    @Override
    public String setTitle() {
        return "文本类";
    }
}
